package com.sun.base;


import android.content.Intent;
import android.widget.FrameLayout;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;

import com.mobclick.android.MobclickAgent;
import com.sun.lotter.DoubleLotterNewsActivity;
import com.tools.SysInterfacePhone;

public class LogoActivity extends UserActivity {
	
	@Override
	public void init() {
		noTitle = true;
		FrameLayout logo = new FrameLayout(this);
		SysInterfacePhone.invoker().setViewBackground(this, logo, "logo-1.png");
		int screen_w = SysInterfacePhone.invoker().getScreenWidth(this);
		int screen_h = SysInterfacePhone.invoker().getScreenHeight(this);
		
		int logo_w = screen_w>screen_h?screen_h/2:screen_w/2;
		RelativeLayout logoLayout = new RelativeLayout(this);
		RelativeLayout.LayoutParams lp = new RelativeLayout.LayoutParams(logo_w,logo_w);
		
		lp.addRule(RelativeLayout.CENTER_IN_PARENT);
		logoLayout.addView(logo,lp);
		mainLayout.addView(logoLayout,new LinearLayout.LayoutParams(-1,-1));
		MobclickAgent.updateOnlineConfig(this); 

		new Thread(){
			public void run(){				
				try {
					Thread.sleep(1000);
					handler.post(new Runnable() {
						
						@Override
						public void run() {
							Intent intent = new Intent();
							intent.setClass(LogoActivity.this, DoubleLotterNewsActivity.class);
							startActivity(intent);
							LogoActivity.this.finish();
						}
					});
				} catch (InterruptedException e) {
					e.printStackTrace();
				}
			}
		}.start();
	}
	
	@Override
	public void onResume() {
		super.onResume();
		MobclickAgent.onResume(this);
	}
	
	@Override
	public void onPause() {
		super.onPause();
		MobclickAgent.onPause(this);
	}
	
}
